package alpaca.config;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * This class should be used for testing purposes.<p>
 * 
 * This class doesn't support any writing or reading to/from the file-system. 
 */
public class MockConfigurator implements IConfigurator {
	private Map<String, String> data;
	private String file = "";
	
	@Override
	public void save(Map<String, String> data, String file) throws IOException {
		this.data = new HashMap<String, String>();
		this.data.putAll(data);
				
		this.file = file;
	}

	@Override
	public Map<String, String> load(String file) throws IOException {
		if(file.equals(this.file)) {
			return data;
		} else {
			throw new IOException();
		}		
	}

}
